<?php
namespace Admin\Controller;

use Think\Controller;
use Think\Verify;

class CaptchaController extends Controller {

    private $_config = [];
    private $_app;
    public function __construct($config = []) {
        parent::__construct();
        if($config){
            $this->_config = $config;
        }else{
            $this->_config = [
                'useNoise'=>false,
                'fontSize'=>16,
                'imageH'=>34,
                'imageW'=>110,
                'length'=>4,
                'useCurve'=>false,
            ];
        }

        $this->_app = new Verify($this->_config);
    }

    public function show(){
        ob_clean();
        return $this->_app->entry();
    }

    public function check($captcha){
        return $this->_app->check($captcha);
    }
}